home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fbr12c / rwassoc.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1995-09-06  |  3.8 KB  |  126 lines

  1. VERSION 2.00
  2. Begin Form RWAssoc 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Associate"
  6.    ClientHeight    =   1185
  7.    ClientLeft      =   1335
  8.    ClientTop       =   1905
  9.    ClientWidth     =   6675
  10.    ControlBox      =   0   'False
  11.    Height          =   1590
  12.    Left            =   1275
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   1185
  18.    ScaleWidth      =   6675
  19.    Top             =   1560
  20.    Width           =   6795
  21.    Begin TextBox AssProg 
  22.       Height          =   300
  23.       Left            =   1605
  24.       TabIndex        =   2
  25.       Top             =   690
  26.       Width           =   4875
  27.    End
  28.    Begin CommandButton Ass 
  29.       Caption         =   "&Exit"
  30.       Height          =   345
  31.       Index           =   3
  32.       Left            =   5280
  33.       TabIndex        =   4
  34.       Top             =   195
  35.       Width           =   1200
  36.    End
  37.    Begin CommandButton Ass 
  38.       Caption         =   "Ass&ociate"
  39.       Height          =   345
  40.       Index           =   2
  41.       Left            =   3765
  42.       TabIndex        =   3
  43.       Top             =   195
  44.       Width           =   1200
  45.    End
  46.    Begin CommandButton Ass 
  47.       Caption         =   "&View"
  48.       Height          =   345
  49.       Index           =   1
  50.       Left            =   2205
  51.       TabIndex        =   1
  52.       Top             =   195
  53.       Width           =   1200
  54.    End
  55.    Begin TextBox Extension 
  56.       Height          =   300
  57.       Left            =   1155
  58.       TabIndex        =   0
  59.       Top             =   225
  60.       Width           =   615
  61.    End
  62. DefInt A-Z
  63. Sub Ass_Click (Index As Integer)
  64.     NL$ = Chr$(13) + Chr$(10)
  65.     Msg$ = "You must enter an extension first."
  66.     Select Case Index
  67.         Case 1
  68.             Ext$ = LTrim$(RTrim$(Extension.Text))
  69.             If Len(Ext$) Then
  70.                 Prog$ = LTrim$(RTrim$(GetWinStr("extensions", Ext$, "Not Associated")))
  71.                 If Prog$ <> "Not Associated" Then
  72.                     Pos = InStr(1, Prog$, Chr$(32))
  73.                     Prog$ = Left$(Prog$, Pos - 1)
  74.                 End If
  75.                 AssProg.Text = Prog$
  76.             Else
  77.                 MsgBox Msg$, 48, "View Association"
  78.             End If
  79.         Case 2
  80.             Tit$ = "Associate"
  81.             Ext$ = LTrim$(RTrim$(Extension.Text))
  82.             Prog$ = LTrim$(RTrim$(AssProg.Text))
  83.             If Len(Ext$) Then
  84.                 If Len(Prog$) Then Prog$ = Prog$ + Chr$(32) + "^." + Ext$
  85.                 z = PutWinINI("extensions", Ext$, Prog$)
  86.                 If Not z Then
  87.                     MsgBox "Association failure.", 48, Tit$
  88.                 Else
  89.                     AssProg.Text = "Success: " + UCase$(Prog$)
  90.                 End If
  91.             Else
  92.                 MsgBox Msg$, 48, Tit$
  93.             End If
  94.         Case 3
  95.             Unload RWAssoc
  96.     End Select
  97. End Sub
  98. Sub AssProg_KeyPress (KeyAscii As Integer)
  99.     If KeyAscii = (32) Then
  100.         KeyAscii = 0
  101.         Beep
  102.         Beep
  103.     End If
  104. End Sub
  105. Sub Extension_KeyPress (KeyAscii As Integer)
  106.     If KeyAscii = 46 Then
  107.         KeyAscii = 0
  108.         Beep
  109.         Beep
  110.     End If
  111. End Sub
  112. Sub Form_Load ()
  113.     RWAssoc.Left = FBRunWay.Left
  114.     RWAssoc.Top = FBRunWay.Top + FBRunWay.Height
  115. End Sub
  116. Sub Form_Paint ()
  117.     FrameFrm RWAssoc
  118.     FrameCtrl RWAssoc, Extension, Extension, Extension, Extension
  119.     For x = 1 To 3
  120.         FrameCtrl RWAssoc, Ass(x), Ass(x), Ass(x), Ass(x)
  121.     Next x
  122.     FrameCtrl RWAssoc, AssProg, AssProg, AssProg, AssProg
  123.     LeftLabel "Extension:", RWAssoc, Extension
  124.     LeftLabel "Associate With:", RWAssoc, AssProg
  125. End Sub
  126.